import java.util.Stack;

class MyQueue {
    Stack<Integer> stack2;
    Stack<Integer> stack1;
    public MyQueue() {
        stack1 = new Stack<Integer>();
        stack2 = new Stack<Integer>();
    }

    public void push(int x) {
        if(stack1.empty()){
            stack1.push(x);
        }else {
            while(!stack1.empty()){
                stack2.push(stack1.pop());
            }
            stack2.push(x);
            while (!stack2.empty()){
                stack1.push(stack2.pop());
            }
        }
    }

    public int pop() {
        if(stack1 == null){
            return -1;
        }
        return stack1.pop();
    }

    public int peek() {
        return stack1.peek();
    }

    public boolean empty() {
        if(stack1.empty()){
            return true;
        }
        return false;
    }

    public static void main(String[] args) {
        MyQueue myQueue = new MyQueue();
        myQueue.push(1);
    }
}

/**
 * Your MyQueue object will be instantiated and called as such:
 * MyQueue obj = new MyQueue();
 * obj.push(x);
 * int param_2 = obj.pop();
 * int param_3 = obj.peek();
 * boolean param_4 = obj.empty();
 */